package com.shihang.core.apollo.constant;

import org.springframework.util.StringUtils;

public enum Env {

    PRO("PRO", "生产"),
    FAT("FAT", "测试"),
    DEV("DEV", "开发"),
    ;

    private String name;
    private String env;

    Env(String name, String env) {
        this.name = name;
        this.env = env;
    }


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getEnv() {
        return env;
    }

    public void setEnv(String env) {
        this.env = env;
    }


    public static String getEnv(String env) {
        if (StringUtils.isEmpty(env)) {
            return PRO.getName();
        }

        for (Env name : Env.values()) {
            if (name.getName().equalsIgnoreCase(env)) {
                return name.getName();
            }
        }
        return PRO.getName();

    }


}
